finding the sum to nth term of a series